<?php
namespace App\Admin\Extensions\Tools;

use App\Models\Client;
use App\Models\User;
use Encore\Admin\Grid;
use Encore\Admin\Grid\Tools\AbstractTool;

class CheckRepeat extends AbstractTool
{

    public function render()
    {
        return $this->form();
    }

    public function form()
    {
        $grid = new Grid(new Client());

        $grid->column('name','客户姓名');
        $grid->column('mobile','手机号码');
        $grid->column('status','客户类型');
        $grid->column('employee_id','所属销售员')->display(function ($model){
            return User::myTitle($model);
        });

        $grid->filter(function (Grid\Filter $filter){
            $filter->disableIdFilter();
            $filter->equal('mobile','手机号码');
            $filter->expand();
        });
        $grid->column('true_client','模块')->display(function ($model){
            if($model == 1){
                return '客户';
            }
            return '线索';
        });
    }
}
